feat(slack): Add support for handling message_deleted, message_changed - #549
Closed
mlenczewski-tidio wants to merge 6 commits into
Closed
feat(slack): Add support for handling message_deleted, message_changed#549mlenczewski-tidio wants to merge 6 commits into
message_deleted, message_changed#549mlenczewski-tidio wants to merge 6 commits into
Conversation
Contributor
|
@mlenczewski-tidio is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
message_deleted and `message_changed…message_deleted, message_changed
mlenczewski-tidio
force-pushed
the
feat/add-missing-callbacks
branch
from
May 25, 2026 05:19
bf6134d to
4624f49
Compare
mlenczewski-tidio
force-pushed
the
feat/add-missing-callbacks
branch
from
June 11, 2026 14:12
7a52293 to
afe0a60
Compare
message_deleted, message_changedmessage_deleted, message_changed
Contributor
Author
Contributor
Author
…` events in Slack adapter.
…andling in Slack adapter
…e chat prepare rebuildable Upstream vercel#674/vercel#675 introduced the shared @chat-adapter/tests factories and matchers, which the rebased adapter-slack tests now use. The mock ChatInstance did not stub the fork's processMessageUpdated/processMessageDeleted lifecycle processors, so the message_changed/message_deleted suites failed with 'this.chat.processMessageUpdated is not a function'. Add both processors to createMockChatInstance and to the toHaveDispatched handler list. Also make the chat package's prepare script remove dist before tsup: with a previous build's dist/jsx-runtime.d.ts present, the dts step resolves the chat/jsx-runtime export to the built file and fails with TS5055 (cannot overwrite input file). Upstream never hits this because its build script always cleans first; prepare (used for git installs) did not.
mlenczewski-tidio
force-pushed
the
feat/add-missing-callbacks
branch
from
July 8, 2026 09:11
afe0a60 to
7e6f7d3
Compare
Collaborator
|
closed for #788 |
dancer
added a commit
that referenced
this pull request
Aug 5, 2026
## summary adds `onMessageUpdated` and `onMessageDeleted`, so a bot can react when a message is edited or removed. Slack dispatches both today; other adapters can opt in later supersedes #549, which was verified there against real Slack webhooks. reopened from a branch in this repo with the original commits preserved and signed ```typescript bot.onMessageUpdated(async (thread, message, previousMessage) => { await mirror.update(message.id, message.text); }); bot.onMessageDeleted(async (event) => { await mirror.remove(event.messageId); }); ``` both are lifecycle events: they never route through `onNewMessage`, `onNewMention`, or `onSubscribedMessage`, and the concurrency strategies do not apply ### notes - **the bot's own edits are filtered.** slack sends a `message_changed` for every `chat.update`, and post-and-edit streaming calls it once per delta, so without this a single streamed reply would call the handler back repeatedly on its own message - **`previousMessage` is forwarded on edits.** slack sends the pre-edit message and it was being dropped. an edit handler usually needs the before to know what changed, so it is the optional third argument - **the two shapes differ deliberately.** an edit carries a full replacement message, so it gets `(thread, message, previousMessage?)`. a delete has no message, only the id of what was removed, so it gets an event. use `chat.thread(event.threadId)` when a delete handler needs one - **one thread id helper** now serves message, edit, and delete, so an edit cannot resolve to a different thread than the message it edits ## test plan core: - an edit dispatches to `onMessageUpdated` and not to the normal message handlers - the handler receives the pre-edit message as its third argument - the bot's own edits are skipped - a delete dispatches with normalized event data - both run inside the active conversation, so read tools built in these handlers stay scoped slack: - `message_changed` dispatches as an update, `message_deleted` as a delete - `previous_message` is forwarded, and left undefined when slack omits it - hidden unfurl updates stay ignored, hidden real edits still dispatch - message, edit, and delete resolve to one thread id in a flat DM and in a threaded `agent_view` DM verified against a real slack workspace over socket mode: editing and deleting a DM both routed to the same thread id as the original message --------- Co-authored-by: Miłosz Lenczewski <m.lenczewski@tidio.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Chat SDK lifecycle handling for message updates and deletes.
chatAPIs foronMessageUpdated,onMessageDeleted,processMessageUpdated, andprocessMessageDeleted.message_changedevents as message update callbacks.message_deletedevents as normalized delete callbacks with message/thread/channel metadata.Test plan
Slack bot, real webhooks being sent and evaluated.
Checklist
pnpm validatepasses